In existing inkjet printing technologies, some inkjet printers use an optical mechanism to detect whether the ink in the ink cartridge is exhausted, so as to avoid unrecoverable damages to the printer when the ink is exhausted while the printer is still printing, and prevent unnecessary waste of time and paper for users. In US patent application publication No. US2005195225, a solution is disclosed: a light emitting element and a light receiving element are disposed on a printer, and accordingly, a lever is disposed in an ink cartridge of the printer, a floating mark and a light shielding element are provided on two ends of the lever respectively, and a support in the middle of the lever is fixed at the bottom of an ink chamber of the ink cartridge. The ink cartridge has a detection portion protruding outwards and made of a transparent material, and the internal space of the detection portion is capable of accommodating the light shielding element. When the ink cartridge is installed into a printer, the detection portion is located between the light emitting element and the light receiving element. When the ink cartridge contains sufficient ink, the floating mark floats on the surface of the ink due to the buoyancy, and the light shielding element is located inside the detection portion, thus the light emitted from the light emitting element is blocked and the light receiving element cannot receive the light. When the ink in the ink cartridge is exhausted, because there is no buoyancy, the floating mark drops down, and the light shielding element moves upwards, such that the light receiving element receives the light emitted from the light emitting element. Accordingly the printer obtains information indicating that the ink is exhausted, and sends a signal to remind the user. The solution can effectively detect the moment when the ink is exhausted, but it has the disadvantages in the design of the lever: the installation of the floating mark is complicated, so the production efficiency of the ink cartridge is lowered. Furthermore, the light shielding element that moves with the change of the volume of the ink in the ink cartridge must be made of a non-transparent material. In the solution, a black PP material is used, so it is required that the black color master batch and the PP raw material be blended evenly during injection production. If they are not blended evenly or are blended not even enough, the ink cartridge cannot be identified after being installed into the printer. The light shielding element moves with the change of the volume of the ink in the ink cartridge, so a large number of parts are required, resulting in a complex production process.